<?php

namespace App\Http\Controllers;

use App\Models\WxuserMcard;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    /**
     * @return 登录用户信息
     */
    public function getSeesionUser()
    {
        return session('web_auth_user');
    }

    /**
     * @return 登录会员卡信息
     */
    public function getSeesionWxuseMcard($refresh=false)
    {
        if($refresh){
            $wxuser_mcard = WxuserMcard::find(session('web_wxuser_mcard')->id_wxuser_mcard);

            session(['web_wxuser_mcard'=>$wxuser_mcard]);

            return $wxuser_mcard;
        }else{
            return session('web_wxuser_mcard');
        }
    }
}
